<?php
//创建一个新的资源
$ch=curl_init();
$url="http://www.zhibohenan.com/index.php/Home";

curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

$data=curl_exec($ch);

$res='#<div class="w470 overflow fr">.*<dl class="pb10 boder-bb overflow cl mt10 ">.*<dt>.*<a href=".*" class="f20 ">(.*)</a>.*</dt>.*<dd class="hs l-30">.*</dd>.*</dl>.*</div>#isU';


preg_match_all($res,$data,$resd);
$name = $resd[1];

print_r($name);

$sql="insert into pook VALUES";
foreach($name as $k=>$v)
{
    $sql.="(null,'$v','$v'),";
}
$sql=substr($sql,0,-1);
$dbh = new PDO('mysql:host=127.0.0.1;dbname=1705php', 'root', 'root');
echo $dbh->exec($sql);
?>
